Package edu.uky.ai.csp.kr
Class EqualsConstraint
java.lang.Object
edu.uky.ai.csp.kr.Constraint
edu.uky.ai.csp.kr.EqualsConstraint
public class EqualsConstraint extends Constraint
Constrains two variables to have the same value.
- Author:
- Stephen G. Ware
-
Field Summary
-
Constructor Summary
Constructors Constructor Description EqualsConstraint(Variable left, Variable right)Constructs a new equals constraint object. -
Method Summary
Modifier and Type Method Description protected booleantestValues(Solution solution, java.lang.Object left, java.lang.Object right)A helper method for testing values which is defined for each new kind of constraint.java.lang.StringtoString()
-
Constructor Details
-
EqualsConstraint
Constructs a new equals constraint object.- Parameters:
left- the left hand side of the constraintright- the right hand side of the constraint
-
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
testValues
Description copied from class:ConstraintA helper method for testing values which is defined for each new kind of constraint.- Specified by:
testValuesin classConstraint- Parameters:
solution- the candidate solution, which provides context for the testleft- the value for the left variableright- the value for the right variable- Returns:
- false if these values would violate the constraint, true otherwise
-